package org.csu.jpetstore_cms.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.csu.jpetstore_cms.pojo.User;

@Mapper
public interface UserMapper {
    @Select("SELECT * FROM userinfo WHERE id=#{id}")
    User findByID(String id);

    @Select("SELECT * FROM userinfo WHERE name=#{username}")
    User findByUsername(String username);

    @Insert("INSERT into userinfo(id,name,email,password,is_admin) " +
            "values(#{id},#{name},#{email},#{password},#{is_admin})")
    void insertUser(User user);
}
